/**
 * @(#) OverView.as
 *
 * @date		2009. 04. 20.
 * @version		1.0
 * @author		Jo, ChangHun
 * @description	연말정산 메인 view - Mediator
 * 				연말정산 - 탭1 총소득액 Presentation Logic을 관리 
 */
package com.skt.common_hr.yearadjustment.view
{
	import com.skt.common_hr.yearadjustment.view.components.popTotalIncome;
	import com.skt.common_hr.yearadjustment.view.components.reqTotalIncome;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	import mx.core.Application;
	import mx.core.IFlexDisplayObject;
	import mx.managers.PopUpManager;
	
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.mediator.Mediator;
	

	public class reqTotalIncomeMediator extends Mediator
	{
		public static const NAME:String = "reqTotalIncomeMediator"; 



		/**
		* 생성자
		* 
		* @param
		* @return void
		*/
        public function reqTotalIncomeMediator( viewComponent:Object )
        {
            super( NAME, viewComponent );
            view.callLater(initView);
        }
 		
		/**
		* View를 초기화 한다.
		*	- View에 기본사항을 출력하고 data를 load
		* @param
		* @return void
		*/
 		public function initView():void
 		{
 			view.addEventListener(reqTotalIncome.TOTALINCOME_POPUP_OPEN, onPopUpOpen);
 		}
 		
 		//private var totalIncomePop:IFlexDisplayObject;
 		private function onPopUpOpen(event:Event):void{
 			var center:Sprite = Sprite(mx.core.Application.application);
 			
 			var totalIncomePop:IFlexDisplayObject = PopUpManager.createPopUp(center, popTotalIncome, true);
 			PopUpManager.centerPopUp(totalIncomePop);
 			totalIncomePop.y = 50;
 			var popMediator:popTotalIncomeMediator = facade.retrieveMediator(popTotalIncomeMediator.NAME) as popTotalIncomeMediator;
 			popMediator = new popTotalIncomeMediator(totalIncomePop);
 			popMediator.v_year = view._selYear;
 			popMediator.v_enable = view._isEnable;
 			facade.registerMediator(popMediator);
 			/* if(totalIncomePop == null ){
	 			totalIncomePop = PopUpManager.createPopUp(center, popTotalIncome, true);
	 			PopUpManager.centerPopUp(totalIncomePop);
	 			popMediator = new popTotalIncomeMediator(totalIncomePop);
	 			facade.registerMediator(popMediator);
 			}else{
 				PopUpManager.addPopUp(totalIncomePop, center, true);
 				//popMediator = facade.retrieveMediator(popTotalIncomeMediator.NAME) as popTotalIncomeMediator;
 				popMediator.initView();
 			} */
 		}
 		

		///////////////////////////////////////////////////////////////////////////////////////////////////
		//
		//	Process MVC Messages
		//
		///////////////////////////////////////////////////////////////////////////////////////////////////
		/**
		* 본 Class에서 처리해야할 Noti들을 등록한다.
		* 
		* @param
		* @return void
		*/
		override public function listNotificationInterests():Array 
		{
			return [
					];
		}
		

		/**
		* Noti별로 처리한다.
		* 
		* @param
		* @return void
		*/
		override public function handleNotification(note:INotification):void
		{
			switch(note.getName()) 
			{
				default:
					//trace(this.instanceID+"에서 처리 안된 Noti가 검출됨 : " + note.getBody());
					break;
			}
		}
 		
		
		///////////////////////////////////////////////////////////////////////////////////////////////////
		//
		//	Utility Functions
		//
		///////////////////////////////////////////////////////////////////////////////////////////////////
        private function get view():reqTotalIncome
        {
            return viewComponent as reqTotalIncome;
        }
	}
}